/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.teamreinforce.logic.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author tidiane
 */
@Entity
@Table(name = "etape")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Etape.findAll", query = "SELECT e FROM Etape e"),
    @NamedQuery(name = "Etape.findByIdEtape", query = "SELECT e FROM Etape e WHERE e.idEtape = :idEtape"),
    @NamedQuery(name = "Etape.findByLibelle", query = "SELECT e FROM Etape e WHERE e.libelle = :libelle"),
    @NamedQuery(name = "Etape.findByDateDebut", query = "SELECT e FROM Etape e WHERE e.dateDebut = :dateDebut"),
    @NamedQuery(name = "Etape.findByDateFin", query = "SELECT e FROM Etape e WHERE e.dateFin = :dateFin"),
    @NamedQuery(name = "Etape.findByDuree", query = "SELECT e FROM Etape e WHERE e.duree = :duree")})
public class Etape implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_etape")
    private Integer idEtape;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "libelle")
    private String libelle;
    @Lob
    @Size(max = 65535)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "date_debut")
    private String dateDebut;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "date_fin")
    private String dateFin;
    @Column(name = "duree")
    private Integer duree;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "etape")
    private List<Tache> tacheList;
    @JoinColumn(name = "projet", referencedColumnName = "id_projet")
    @ManyToOne(optional = false)
    private Projet projet;

    public Etape() {
    }

    public Etape(Integer idEtape) {
        this.idEtape = idEtape;
    }

    public Etape(Integer idEtape, String libelle, String dateDebut, String dateFin) {
        this.idEtape = idEtape;
        this.libelle = libelle;
        this.dateDebut = dateDebut;
        this.dateFin = dateFin;
    }

    public Integer getIdEtape() {
        return idEtape;
    }

    public void setIdEtape(Integer idEtape) {
        this.idEtape = idEtape;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(String dateDebut) {
        this.dateDebut = dateDebut;
    }

    public String getDateFin() {
        return dateFin;
    }

    public void setDateFin(String dateFin) {
        this.dateFin = dateFin;
    }

    public Integer getDuree() {
        return duree;
    }

    public void setDuree(Integer duree) {
        this.duree = duree;
    }

    @XmlTransient
    public List<Tache> getTacheList() {
        return tacheList;
    }

    public void setTacheList(List<Tache> tacheList) {
        this.tacheList = tacheList;
    }

    public Projet getProjet() {
        return projet;
    }

    public void setProjet(Projet projet) {
        this.projet = projet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEtape != null ? idEtape.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Etape)) {
            return false;
        }
        Etape other = (Etape) object;
        if ((this.idEtape == null && other.idEtape != null) || (this.idEtape != null && !this.idEtape.equals(other.idEtape))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.teamreinforce.logic.entities.Etape[ idEtape=" + idEtape + " ]";
    }
    
}
